package com.gen.web.view;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.gen.web.BaseController;
@Controller
@RequestMapping("/admin")
public class WebViewController extends BaseController{
	protected final Logger log = LoggerFactory.getLogger(this.getClass());
	/**
	 * 默认首页
	 * @author liq 2012-9-17
	 */
    @RequestMapping(value="/",method={RequestMethod.GET})
    public String index(Model model,HttpServletRequest request,HttpServletResponse response) {
        return "index";
    }
    
    @RequestMapping(value="/test1",method={RequestMethod.GET})
    public ModelAndView test1(HttpServletRequest request) {
        ModelAndView mv = new ModelAndView("NewFile");
        mv.addObject("name", "My First Spring Mvc");
        return mv;
    }
    @RequestMapping(value="/test2",method={RequestMethod.GET})
    public String test2(Model model,HttpServletRequest request,HttpServletResponse response) {
    	model.addAttribute("name", "liqiang");
        return "demo/NewFile";
    }
}
